package com.itheima.d0_homework.timu1;

import java.util.Calendar;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //定义键盘录入
        Scanner scanner = new Scanner( System.in);
        System.out.println("请输入一个年份");
        int year =scanner.nextInt();

        //调用getInstance()方法创建Calendar对象
        Calendar cl = Calendar.getInstance();
        //国内是2.1号，改成2。1号
        cl.set(year,2,1);
        //2月减少一天
        cl.add(Calendar.DATE,-1);
        //得到减少之后的天数;
        int i = cl.get(Calendar.DATE);
        System.out.println(i);

        if(i == 28){
            System.out.println("平年，共365天");
        }else {
            System.out.println("闰年，共366天");
        }
    }
}
